package com.cy.sapling.admin.web;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2017/11/16.
 */
@RestController
@RefreshScope
public class ConfigTestWeb {

//    @Value("${message}")
    private String message;

//    @Value("${spring.datasource.url}")
    private String url;

//    @Value("${spring.datasource.username}")
    String username;

//    @Value("${spring.datasource.password}")
    private String password;

//    @Value("${spring.datasource.driver-class-name}")
    private String driverClassName;

    @GetMapping("/message")
    public String hello() {
        return this.message;
    }

    @RequestMapping("map")
    public Map<String,String> map() {
        Map<String,String> map=new HashMap<>();
        map.put("url",url);
        map.put("username",username);
        map.put("password",password);
        map.put("driverClassName",driverClassName);
        return map;
    }
}
